<?php
/*code here*/
/* If user click the button/link to logged out. */
$db = new Database();
$auth = Auth::getAuth('current_user');
$userID = $auth['id'];
$timezone = "Asia/Manila";

//echo '<input type="text" value="'.$date.'" />';
if(function_exists('date_default_timezone_set')) date_default_timezone_set($timezone);
$destroy = Auth::destroyAuth('current_user');

if($destroy){
    $audit = array(
                "user_id"=>$userID,
                "action_id"=>10,
                "affected_table"=>"tbuser",
                "affected_record"=>$userID,
                "datetime"=>date("Y-m-d  H:i:s"),
                "is_active"=>1
            );
    $db->insert("tbaudit_trail",$audit);
    
    header('location: /');
}
/*code here(end)*/
exit;
$this->setLayout();
